package com.zzt.questionbankusermanager.mapper;

import com.zzt.questionbankusermanager.bean.MenuItem;
import com.zzt.questionbankusermanager.bean.dto.MenuItemDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper(componentModel="spring")
public interface MenuItemConverter {
    MenuItemConverter INSTANCE= Mappers.getMapper(MenuItemConverter.class);

    @Mappings({
            @Mapping(source = "menu_url",target = "url"),
            @Mapping(source = "menu_icon",target = "icon")
    })
    MenuItemDTO doToDto(MenuItem entity);
    List<MenuItemDTO> doToDTO(List<MenuItem> dos);


    @Mappings({
            @Mapping(source = "url",target = "menu_url"),
            @Mapping(source = "icon",target = "menu_icon")
    })
    MenuItem dtoToDO(MenuItemDTO dto);
    List<MenuItem> dtoToDo(List<MenuItemDTO> dtos);

}
